const cloneDeep =require('lodash.clonedeep');
const sqlectron = require('sqlectron-core');
console.log(sqlectron);
//sqlectron.servers.getAll();
//console.log(sqlectron.db.CLIENTS.length);
//console.log(sqlectron.db.CLIENTS);
var serverConfig={client:"sqlite"}
var db=sqlectron.db.createServer(serverConfig);
//console.log(db);
var con=db.createConnection("/home/mhq/python/parts/data.sqlite")
console.log(con);
async function getContacts(){
	let  results= await con.executeQuery("select * from parts_contact;");
	//.then((data)=>{
	//	for(var i in data){
	//		console.log(i);
	//	}
		// con.executeQuery("insert into ma(id) values(1);");
		// var ts=con.listTables().then((data)=>{
		// 	console.log(data);
		// });
	//});
	//const results = cloneDeep(remoteResult);
	console.log("results:"+results);
	for(var i in results){
		console.log(i,results[i]);
	}
}
con.connect().then(()=>{
	console.log("connected");
	getContacts();
});
//con.executeQuery("create table ma(id int)");